package com.caseProject.puremvc.mediator.view
{
	import com.caseProject.puremvc.mediator.gui.AbstractDiagramMenu;
	
	import fl.controls.List;
	
	import flash.display.Sprite;
	
	public class MainView extends Sprite
	{
		private var _projectMenu:MenuProjectView;
		private var _diagramMenu:AbstractDiagramMenu;
		private var _projectList:MenuDiagramListView;
		private var _projectStage:StageView;
		private var _menuEditOptions:MenuEditOptionsView;
		
		public function MainView()
		{
			super();
			
			this.configView ();
		}
		
		private function configView():void
		{
			this.projectMenu = new MenuProjectView ();
			this.diagramMenu = new MenuIdleToolsView ();
			this.projectList = new MenuDiagramListView ();
			this.projectStage = new StageView ();
			this.menuEditOptions = new MenuEditOptionsView();
			
			this.addChild(this.projectMenu);
			this.addChild(this.diagramMenu);
			this.addChild(this.projectList);
			this.addChild(this.menuEditOptions);
			
			this.updateView ();
		}
		
		public function updateView ():void 
		{
			this.diagramMenu.x = this.projectMenu.x + this.projectMenu.width;
			this.diagramMenu.y = this.projectMenu.y;
			
			this.projectList.width = this.projectMenu.width;
			this.projectList.x = this.projectMenu.x;
			this.projectList.y = this.projectMenu.y + this.projectMenu.height + 5;
			
			this.menuEditOptions.width = this.projectMenu.width;
			this.menuEditOptions.x = this.projectList.x;
			this.menuEditOptions.y = this.projectList.y + this.projectList.height + 5;
			
			this.projectStage.x = this.projectMenu.x + this.projectMenu.width + 5;
			this.projectStage.y = this.diagramMenu.y + this.diagramMenu.height + 5;		
		}
		
		public function changeMenuDiagram(DiagramMenu:Class):void
		{
			this.removeChild(this.diagramMenu);
			this.diagramMenu = new DiagramMenu() as AbstractDiagramMenu;
			
			this.projectStage.clearStage();
			
			this.addChild(this.diagramMenu);
			this.addChild(this.projectStage);
			
			this.updateView ();
		}
		
		public function get menuEditOptions():MenuEditOptionsView
		{
			return _menuEditOptions;
		}
		
		public function set menuEditOptions(value:MenuEditOptionsView):void
		{
			_menuEditOptions = value;
		}
		
		public function get projectStage():StageView
		{
			return _projectStage;
		}
		
		public function set projectStage(value:StageView):void
		{
			_projectStage = value;
		}
		
		public function get projectMenu():MenuProjectView
		{
			return _projectMenu;
		}
		
		public function set projectMenu(value:MenuProjectView):void
		{
			_projectMenu = value;
		}
		
		public function get diagramMenu():AbstractDiagramMenu
		{
			return _diagramMenu;
		}
		
		public function set diagramMenu(value:AbstractDiagramMenu):void
		{
			_diagramMenu = value;
		}
		
		public function get projectList():MenuDiagramListView
		{
			return _projectList;
		}
		
		public function set projectList(value:MenuDiagramListView):void
		{
			_projectList = value;
		}
	}
}